export default {
  namespaced: true,
  state: {
    tabList: [],
  },
  mutations: {
    addTab: (state, tab) => {
      // 如果tab已经存在，不添加新的tabs
      if (state.tabList.some((item) => item.path === tab.path)) {
        return;
      }
      state.tabList.push(tab);
    },
    setTabs: (state, tabs) => {
      state.tabList = tabs;
    },
  },
  getters: {
    // 获取tbsList
    getTabs: (state) => {
      return state.tabList;
    },
  },
};
